<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
		<meta name="format-detection" content="telephone=no, email=no" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style" />
		<!--控制条块状黑色-->
		<meta content="telephone=no" name="format-detection" />
		<!--禁止数字转拨号-->
		<link rel="stylesheet" type="text/css" href="css/reset.css">
		<link href="css/iconfont.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="libs/swiper.min.css" />
		<link rel="stylesheet" type="text/css" href="libs/calendar_base.css" />
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<script src="js/jquery-1.11.3.min.js"></script>
		<!-- 	<script src="https://cdn.bootcss.com/eruda/1.5.4/eruda.js"></script> -->
		<!--百度地图-->
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=nxW0akynjKF8Ag0G0uVVwq0t6ak1Q1Zj"></script>
		<!-- <script>
			eruda.init();
		</script> -->
	</head>
	<body>
		<!--内容区-->
		<div class="mui-content">
			<!--日历盒子-->
			<div class="calendar-box">
				<div class="em-journal-title">
					<div class="em-per-block pre">
						<span class="mui-icon mui-icon-arrowleft"></span>
						<span>上一月</span>
					</div>
					<div class="em-per-block mid">
						<span></span>
					</div>
					<div class="em-per-block next">
						<span>下一月</span>
						<span class="mui-icon mui-icon-arrowright"></span>
					</div>
				</div>
				<!--日历容器-->
				<div id="preloader"  >
				</div> 
				<div id="calendar">
				</div>
				<div class="tb">
					<span class="red"></span><b>超期</b>
					<span class="green"></span><b>已完成</b>
					<span class="yellow"></span><b>待完成</b>
				</div>
				<!--返回今天-->
				<!--<div class="backToday">
                返回今日
            </div>-->
			</div>
			<!-- 维保任务 -->
			<div class="task">
				<div class="mui-slider">
					<div class="mui-slider-group">
						<div class="mui-slider-item">
							<div class="task_cont wb">
								<div class="task_title">
									<span class="col_violet">维</span><span class="col_violet">保</span><span class="col_violet">任</span><span class="col_violet">务</span>
								</div>
								<div class="task_inner">

									<div class="task_top">
										<ul>
											<li>
												<a href="javascript:;">
													<div class="task_ge">
														<span> <b></b> </span>
														<p class="col_violet">今日工单</p>
													</div>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<div class="task_list"><span class="col_violet"> </span>
														<p> <i></i> 待处理 </p>
													</div>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<div class="task_list"><span class="col_violet"> </span>
														<p> <i></i> 处理中 </p>
													</div>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<div class="task_list"><span class="col_violet"> </span>
														<p> <i></i> 已确认 </p>
													</div>
												</a>
											</li>
											<div class="both"></div>
										</ul>
									</div>
									<!-- 中间虚线 + 半圆-->
									<div class="warn-hx">
										<i></i><i></i>
									</div>
									<div class="task_bottom">
										<ul>
											<li>
												<a href="javascript:;">
													<p> 本月工单数 <span class="col_violet"></span> </p>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<p> 上月工单数 <span class="col_violet"></span> </p>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<p> 累计工单数 <span class="col_violet"></span> </p>
												</a>
											</li>
											<div class="both"></div>
										</ul>
									</div>

								</div>

							</div>
						</div>
						<div class="mui-slider-item">
							<div class="task_cont jj">
								<div class="task_title">
									<span class="col_violet">紧</span><span class="col_violet">急</span><span class="col_violet">任</span><span class="col_violet">务</span>
								</div>
								<div class="task_inner">
									<div class="task_top">
										<ul>
											<li>
												<a href="javascript:;">
													<div class="task_ge">
														<span> <b></b> </span>
														<p class="col_violet">今日工单</p>
													</div>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<div class="task_list">
														<span class="col_violet"> </span>
														<p> <i class=""></i> 待处理 </p>
													</div>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<div class="task_list"><span class="col_violet"> </span>
														<p> <i class=""></i> 处理中 </p>
													</div>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<div class="task_list"><span class="col_violet"> </span>
														<p> <i class=""></i> 已确认 </p>
													</div>
												</a>
											</li>
											<div class="both"></div>
										</ul>
									</div>
									<!-- 中间虚线 + 半圆-->
									<div class="warn-hx">
										<i></i><i></i>
									</div>
									<div class="task_bottom">
										<ul>
											<li>
												<a href="javascript:;">
													<p> 本月工单数 <span class="col_violet"></span> </p>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<p> 上月工单数 <span class="col_violet"></span> </p>
												</a>
											</li>
											<li>
												<a href="javascript:;">
													<p> 累计工单数 <span class="col_violet"></span> </p>
												</a>
											</li>
											<div class="both"></div>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="mui-slider-indicator">
						<div class="mui-indicator  mui-active"></div>
						<div class="mui-indicator"></div>
					</div>
				</div>
				<!--二级页面图标-->
				<div class="page-links">
					<ul>
						<li>
							<a href="html/yearWarning/year-warn.html#pending"><i></i>
								<p>维保工单</p>
							</a>
							<span class="mui-badge test"></span>
							<!--提醒-->
						</li>
						<li>
							<a href="html/overdue/over-list.html"><i></i>
								<p>超期提醒</p>
							</a>
							<span class="mui-badge test"></span>
						</li>
						<li>
							<a href="html/urgent/urgent-list.html"><i></i>
								<p>急单工单</p>
							</a>
							<span class="mui-badge test"></span>
						</li>
						<li>
							<a href="html/runWarning/run-warn.html"><i></i>
								<p>运行预警</p>
							</a>
							<span class="mui-badge test"></span>
						</li>
					</ul>
				</div>
			</div>
			<script src="js/mui.min.js"></script>
			<script src="js/mui.view.js"></script>
			<script src="js/loading.js"></script>
			<script src="js/main.js"></script>
			<script src="libs/swiper.min.js" type="text/javascript" charset="utf-8"></script>
			<script src="libs/mustache.min.js" type="text/javascript" charset="utf-8"></script>
			<script src="libs/calendar_base.js" type="text/javascript" charset="utf-8"></script>
			<script src="js/calendar_showcase.js" type="text/javascript" charset="utf-8"></script>
			<script>
				$(function() {
					mui.ready(function() {
						//加载框
						mui.showLoading("正在加载..", ".warn-list")
						//请求
						Request();
						//获取当前时间 yyyy-mm
						function getNowFormatDates() {
							var date = new Date();
							var seperator1 = "-";
							var month = date.getMonth() + 1;
							var strDate = date.getDate();
							if (month >= 1 && month <= 9) {
								month = "0" + month;
							}
							if (strDate >= 0 && strDate <= 9) {
								strDate = "0" + strDate;
							}
							var currentdate = date.getFullYear() + seperator1 + month;
							return currentdate;
						}
						//当前时间
						var time1 = getNowFormatDates();
						var userid = localStorage.getItem('userid');
						var token = localStorage.getItem('token');
						// ajax
						var postData = {
							userid: userid,
							token: token,
							currmonth: time1,
							currtime: getNowFormatDate()
						}

						function Request() {

						}
						$.ajax(domain + "/dtwbgl/wbfirstpage.h5", {
							// data: JSON.stringify(postData),
							data: postData,
							dataType: 'json', //服务器返回json格式数据
							type: 'post', //HTTP请求类型
							timeout : 50000, // 超时时间设置为50秒；
							headers: {
								'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
							},
							async: true, //true异步加载
							success: function(data) {
								console.log(JSON.stringify(data));
								if (data.code == 2001) {
									var resData = data.data;
									// alert(resData);
									$(".jj .task_ge span b").html(resData.jj.wbtoday);
									$(".jj .task_top li:nth-child(2) span").html(resData.jj.wait);
									$(".jj .task_top li:nth-child(3) span").html(resData.jj.cling);
									$(".jj .task_top li:nth-child(4) span").html(resData.jj.qr);
									$(".jj .task_bottom li:nth-child(1) span").html(resData.jj.currmonth);
									$(".jj .task_bottom li:nth-child(2) span").html(resData.jj.premonth);
									$(".jj .task_bottom li:nth-child(3) span").html(resData.jj.allyear);
									$(".wb .task_ge span b").html(resData.wb.wbtoday);
									$(".wb .task_top li:nth-child(2) span").html(resData.wb.wait);
									$(".wb .task_top li:nth-child(3) span").html(resData.wb.cling);
									$(".wb .task_top li:nth-child(4) span").html(resData.wb.qr);
									$(".wb .task_bottom li:nth-child(1) span").html(resData.wb.currmonth);
									$(".wb .task_bottom li:nth-child(2) span").html(resData.wb.premonth);
									$(".wb .task_bottom li:nth-child(3) span").html(resData.wb.allyear);
									var webnum = resData.wbgd;
									var cqnum = resData.cq;
									var jjgdnum = resData.jjgd;
									var gznum = resData.gz;
									
									mui.hideLoading(function() { //隐藏后的回调函数  
									});
									if (webnum != 0) {
										$('.page-links ul li:nth-child(1) span').css('display', 'block');
										$('.page-links ul li:nth-child(1) span').text(webnum);
									}
									if (cqnum != 0) {
										$('.page-links ul li:nth-child(2) span').css('display', 'block');
										$('.page-links ul li:nth-child(2) span').text(cqnum);
									}
									if (jjgdnum != 0) {
										$('.page-links ul li:nth-child(3) span').css('display', 'block');
										$('.page-links ul li:nth-child(3) span').text(jjgdnum);
									}
									if (gznum != 0) {
										$('.page-links ul li:nth-child(4) span').css('display', 'block');
										$('.page-links ul li:nth-child(4) span').text(gznum);
									}

								} else if (data.code == 2002) {
									mui.toast(data.msg);
									mui.openWindow({
										url: 'login.html',
										id: 'login.html'
									})
								} else {
									mui.toast(data.msg);
									mui.openWindow({
										url: 'login.html',
										id: 'login.html'
									})
								}
							},
							error: function(xhr, type, errorThrown) {
								//异常处理； 
								// console.log(type);
								mui.toast(data.msg);
								mui.openWindow({
									url: 'login.html',
									id: 'login.html'
								})
							}
						});
					});
					//获得slider插件对象
					var gallery = mui('.mui-slider');
					gallery.slider({
						// interval: 5000 //自动轮播周期，若为0则不自动播放，默认为0；
					});
				})
			</script>
	</body>

</html>
